﻿using Microsoft.AspNetCore.Mvc;
using Service.IService;
using Service.UICommand;
using Service.ViewModel;

namespace WebAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class LoginController : ControllerBase
    {
         
        private readonly ILoginService loginService;

        public LoginController(ILoginService _loginService)
        {
            loginService = _loginService;
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>      
        [HttpPost]
        public UserViewModel Login([FromForm]LoginUiCommand model)
        {
             
            var user = loginService.Login(model);
            return  user;
        }


    }
}